<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@tag pageEncoding="UTF-8" isELIgnored="false"  %>
<style>
    .content i{
        color: #393D49;
        cursor: pointer;
    }

    .content i:hover{
        color: #1E9FFF;
    }
</style>

<div class="layui-inline" style="margin-bottom: 4px;">
    <input type="hidden" name="customId">
    <div class="label">客户</div>
    <div style="display: inline-block;width: 160px;">
        <div style="position: relative">
            <input type="text" name="custom" class="layui-input" lay-verify="custom" lay-filter="custom"  readonly style="padding-right: 30px;">
            <div style="position: absolute;top: 10px; right: 10px;">
                <i class="layui-icon layui-icon-more" id="selectCustom"></i>
            </div>
        </div>
    </div>
    <script>
        get("${baseUrl}custom/custom/getDefault.action", function (res) {
            if (res.code == 1){
                $("[name='custom']").val(res.data.name);
                $("[name='customId']").val(res.data.id);

                if($('[name="contacts"]').val()==''){
                    $('[name="contacts"]').val(res.data.contacts);
                }
                if($('[name="phone"]').val()=='') {
                    $('[name="phone"]').val(res.data.phone);
                }

                if($('[name="address"]').val()=='') {
                    $('[name="address"]').val(res.data.address);
                }
            }
        });

        $("#selectCustom").click(function () {
            openBigHtmlDialog("选择供应商", "${baseUrl}select/selectCustom.action");
        });

        function getSelectCustom(data) {
            $("[name='custom']").val(data.name);
            $("[name='customId']").val(data.id);

            //送货信息
            if($('[name="contacts"]').val()==''){
                $('[name="contacts"]').val(data.contacts);
            }
            if($('[name="phone"]').val()=='') {
                $('[name="phone"]').val(data.phone);
            }

            if($('[name="address"]').val()=='') {
                $('[name="address"]').val(data.address);
            }

        }
    </script>
</div>